<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ page import="net.tanesha.recaptcha.ReCaptcha"%>
<%@ page import="net.tanesha.recaptcha.ReCaptchaFactory"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>User Manager</title>

<script type="text/javascript"
	src="<c:url value="/resources/js/jquery-1.11.0.min.js" />"></script>
<script type="text/javascript"
	src="<c:url value="/resources/js/bootstrap.js " />"></script>

<link href="<c:url value="/resources/css/bootstrap.min.css " />"
	rel="stylesheet" type="text/css" />
<link href="<c:url value="/resources/css/style.css" />" rel="stylesheet"
	type="text/css" />
<link href="<c:url value="/resources/css/common.css" />"
	rel="stylesheet" type="text/css" />
<link href="<c:url value="/resources/css/backend/style.css" />" rel="stylesheet"
	type="text/css" />

<script type="text/javascript">
	var strings = new Array();
	strings['recaptcha.instructions_visual'] = "<spring:message code='recaptcha.instructions_visual' javaScriptEscape='true'/>";
	strings['recaptcha.instructions_audio'] = "<spring:message code='recaptcha.instructions_audio' javaScriptEscape='true'/>";
	strings['recaptcha.play_again'] = "<spring:message code='recaptcha.play_again' javaScriptEscape='true'/>";
	strings['recaptcha.cant_hear_this'] = "<spring:message code='recaptcha.cant_hear_this' javaScriptEscape='true'/>";
	strings['recaptcha.visual_challenge'] = "<spring:message code='recaptcha.visual_challenge' javaScriptEscape='true'/>";
	strings['recaptcha.audio_challenge'] = "<spring:message code='recaptcha.audio_challenge' javaScriptEscape='true'/>";
	strings['recaptcha.refresh_btn'] = "<spring:message code='recaptcha.refresh_btn' javaScriptEscape='true'/>";
	strings['recaptcha.help_btn'] = "<spring:message code='recaptcha.help_btn' javaScriptEscape='true'/>";
	strings['recaptcha.incorrect_try_again'] = "<spring:message code='recaptcha.incorrect_try_again' javaScriptEscape='true'/>";

	var RecaptchaOptions = {
		custom_translations : {
			instructions_visual : strings['recaptcha.instructions_visual'],
			instructions_audio : strings['recaptcha.instructions_audio'],
			play_again : strings['recaptcha.play_again'],
			cant_hear_this : strings['recaptcha.cant_hear_this'],
			visual_challenge : strings['recaptcha.visual_challenge'],
			audio_challenge : strings['recaptcha.audio_challenge'],
			refresh_btn : strings['recaptcha.refresh_btn'],
			help_btn : strings['recaptcha.help_btn'],
			incorrect_try_again : strings['recaptcha.incorrect_try_again']
		},
		theme : 'clean'
	};
</script>

</head>
<body>
	<div class="main_wrapper">
		<div class="header_wrapper">
			<div class="container-fluid">
				<div class="header_inner_wrapper clearfix">
					<div class="row-fluid">
						<div class="header_left span4">User Data Setup</div>
					</div>
				</div>
				<div class="content_wrapper">
					<div class="container-fluid">
						<div class="row-fluid">
							<div class="input_box_wrapper">
								<div class="input_box_wrapper_text_aery">
									<div class="span6">
										<form:form method="POST" commandName="user"
											action="${pageContext.request.contextPath}/user/add/process.html" class="form-horizontal" >
											<div>${message}</div>
											<div class="control-group">
												<label class="control-label" for="inputEmail">User Category :</label>
												<div class="controls"><form:select itemValue="id" itemLabel="name"
															path="userCategory.id" items="${userCategoryMap}">
														</form:select></div>
											</div>
												<div class="control-group">
												<label class="control-label" for="inputEmail">User Name</label>
												<div class="controls"><form:input path="userName" /></div>
													<div class="controls"><form:errors path="userName" cssClass="error"></form:errors></div>
												</div>
												<div class="control-group">
												<label class="control-label" for="inputEmail">Password :</label>
												<div class="controls"><form:password path="password" /></div>
													<div class="controls"><form:errors path="password" cssClass="error"></form:errors></div>
												</div>
												<div class="control-group">
												<label class="control-label" for="inputEmail">Email :</label>
												<div class="controls"><form:input path="email" /></div>
													<div class="controls"><form:errors path="email" cssClass="error"></form:errors></div></div>
												<div class="control-group">
												<label class="control-label" for="inputEmail">Telephone :</label>
												<div class="controls"><form:input path="telephone" /></div>
													<div class="controls"><form:errors path="telephone" cssClass="error"></form:errors></div></div>
												<div class="control-group">
												<label class="control-label" for="inputEmail">Address :</label>
												<div class="controls"><form:textarea path="address" /></div></div>

											<div id="captcha_paragraph">
												<c:if test="${invalidRecaptcha == true}">
													<span class="error_form_validation">type here</span>
												</c:if>
												<%
													ReCaptcha c = ReCaptchaFactory.newReCaptcha(
																"6LcW3OASAAAAAKEJTHMmp_bo5kny4lZXeDtgcMqC",
																"6LcW3OASAAAAAKVX2duVsSy2uMMHL105-jPDrHMD", false);
														out.print(c.createRecaptchaHtml(null, null));
												%>
											</div>
											<div>${messageRecaptcha}</div>
											<table>
												<tr>
													<td colspan="2"><input class="btn btn-inverse save" type="submit" value="Save" /></td>
												</tr>
											</table>
										</form:form>
										<div class="btn btn-info">
											<a href="${pageContext.request.contextPath}/index.html">Home
												page</a>
										</div>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</body>
</html>